function setenv($name, $value) {
    # 设置当前会话的环境变量
    $env:$name = $value
    
    # 设置用户级别的环境变量（持久化）
    [System.Environment]::SetEnvironmentVariable($name, $value, [System.EnvironmentVariableTarget]::User)
    
    Write-Host "Environment variable $name set to $value (applies to new sessions)" -ForegroundColor Green
}